package com.gujiangbo.stream;

import java.util.*;
import java.util.stream.Collectors;

public class StreamTest {

    public static void main(String[] args) {
        List<String> list = Arrays.asList("张安", "网无Wie", "李四", "周文王", "张国老", "张德明", "张搜集", "熬好", "张无忌四");
        List<String> list1 = list.stream().filter(name -> name.startsWith("张")).collect(Collectors.toList());
        LinkedList<String> linkedList = list.stream().filter(name -> name.startsWith("张")).collect(Collectors.toCollection(LinkedList::new));

        Map<Integer, String> map = list.stream().filter(name -> name.startsWith("张")).collect(Collectors.toMap(String::hashCode, String::toString));

        System.out.println(map);
    }
}
